package com.ep.modules.app.controller;

import com.ep.common.annotation.SysLog;
import com.ep.common.utils.PageUtils;
import com.ep.common.utils.R;
import com.ep.common.validator.ValidatorUtils;
import com.ep.modules.app.entity.AppEquipmentMaintenanceTask;
import com.ep.modules.app.service.AppEquipmentMaintenanceTaskService;
import java.util.Map;
import org.springframework.beans.factory.annotation.*;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/app/equipment_maintenance_task")
public class AppEquipmentMaintenanceTaskController {
    @Autowired
    private AppEquipmentMaintenanceTaskService appEquipmentMaintenanceTaskService;

    @GetMapping("/list")
    public R list(Map<String, Object> params) {
        PageUtils page = appEquipmentMaintenanceTaskService.queryPage(params);
        return R.ok().put("page", page);
    }

    @GetMapping("/info/{id}")
    public R info(@PathVariable Long id) {
        AppEquipmentMaintenanceTask appequipmentmaintenancetask = appEquipmentMaintenanceTaskService.getById(id);
        return R.ok().put("appequipmentmaintenancetask", appequipmentmaintenancetask);
    }

    @SysLog("保存AppEquipmentMaintenanceTask")
    @PostMapping("/save")
    public R save(@RequestBody AppEquipmentMaintenanceTask appequipmentmaintenancetask) {
        ValidatorUtils.validateEntity(appequipmentmaintenancetask);
        appEquipmentMaintenanceTaskService.save(appequipmentmaintenancetask);
        return R.ok();
    }

    @SysLog("修改AppEquipmentMaintenanceTask")
    @PostMapping("/update")
    public R update(@RequestBody AppEquipmentMaintenanceTask appequipmentmaintenancetask) {
        ValidatorUtils.validateEntity(appequipmentmaintenancetask);
        appEquipmentMaintenanceTaskService.update(appequipmentmaintenancetask);
        return R.ok();
    }

    @SysLog("删除AppEquipmentMaintenanceTask")
    @PostMapping("/delete")
    public R delete(@RequestBody Long[] ids) {
        appEquipmentMaintenanceTaskService.deleteBatch(ids);
        return R.ok();
    }
}